<?php
$url=$_GET['p'];
$url=explode('/', $url);
$p='includes/pages/'.$url[0].'.php';
$c='includes/pages/'.$url[1].'.php';
$erro = 'includes/pages/error.php';

if(!empty($url[1])){
	if(file_exists($c)){
	include $c;
	}
	else include $erro;
}
else{
	if(!empty($url[0])){
		if(file_exists($p)){
		include $p;
		}
		else include $erro;
	}
	else{
		include 'includes/pages/home.php';}
	}


?>